/**
 * 根据类型设置颜色
 */
const color = (kind) => {
	if (kind == "猫") {
		return "#FEFEFE";
	} else if (kind == "狗") {
		return "#55555";
	}
};

/**
 * 添加用户信息
 */
function WithUsers(record) {
	let data = record || {};
	data["color"] = color(data.kind);
	data["tommorrow"] = Process("scripts.day.NextDay", new Date());
	data["test"] = Process("scripts.day.Test");
	data["users"] = Process("models.xiang.user.Get", {
		limit: 2,
		select: ["id", "name"],
	});
	return data;
}

/**
 * js 调用flow 测试
 * flows的指令：yao run flows.findxx 3 '::{}'
 * scripts指令：yao run scripts.pet.format.connFlow '::{"kind":"猫"}'
 */
function connFlow(record) {
	let data = record || {};

	data["flow_findxx"] = Process("flows.findxx", [3,'::{}']);
	return data;
}
